<template>
  <section>
    <el-row style="margin: -3px 0px 0px 1px">
      <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item :to="{ path: '/system/dashboard' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>订单管理</el-breadcrumb-item>
        <el-breadcrumb-item>结算管理</el-breadcrumb-item>
      </el-breadcrumb>
    </el-row>

    <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
      <el-form :inline="true" style="float:left;margin: 18px 27px -40px">
        <el-form-item>
          <!--          <search-bar @SearchByCustomer="getSettleList" ref="searchBar"/>-->
        </el-form-item>
      </el-form>
    </el-col>

    <el-card style="margin: 18px 2%;width: 95%">
      <el-table
        :data="finalList"
        stripe
        style="width: 100%"
        :max-height="tableHeight">

        <!--选择框-->
        <el-table-column type="selection" width="55"/>
        <!--Form-->
        <el-table-column prop="customer.name" label="客户"/>
        <el-table-column prop="customer.carNum" label="车牌号"/>
        <el-table-column prop="customer.phone" label="电话号码"/>
        <el-table-column prop="customer.address" label="用户地址"/>
        <!--        <el-table-column prop="status" label="状态" :formatter="statusFormatter"/>-->
        <el-table-column label="操作" width="140">
          <template slot-scope="scope">
            <el-tooltip content="路线" placement="bottom" effect="light">
              <el-button
                @click="viewSettle(scope.$index, scope.row)"
                type="text"
                style="font-size: 16px"
                icon="el-icon-edit"/>
            </el-tooltip>
            <el-tooltip content="送达" placement="bottom" effect="light">
              <el-button
                @click="confirmArrive(scope.$index, scope.row)"
                type="text"
                style="font-size: 16px"
                icon="el-icon-delete"/>
            </el-tooltip>
          </template>
        </el-table-column>
      </el-table>
      <el-col :span="24" class="toolbar">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :page-sizes="[5, 10, 20]"
          :page-size="size"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total">
        </el-pagination>
      </el-col>
    </el-card>
    <Map ref="ReturnMap" @reload="getFinalList"/>
  </section>
</template>

<script>
import Map from "./component/Map";
export default {
  name: "Index",
  components: {Map},
  data(){
    return{
      size: 5,
      total: 0,
      page: 1,
      finalList:[]
    }
  },
  methods:{
    getFinalList(){
      this.$axios.post("/orders/getReturnList",{
        page: this.page,
        size: this.size,
      }).then(resp=>{
        if(resp.status===200){
          this.finalList = resp.data.result
          this.total = resp.data.total
        }
      })
    },
    confirmArrive(){

    },
    viewSettle(i,r){
      this.$refs.ReturnMap.openMap(i,r)
      this.$refs.ReturnMap.mapVisible = true;
    },
    handleCurrentChange(page) {
      this.page = page
    },
    handleSizeChange(val) {
      this.size = val
      this.getFinalList()
    },
  },
  computed: {
    tableHeight() {
      return window.innerHeight - 320
    }
  },
  mounted() {
    this.getFinalList()
  }
}
</script>

<style scoped>

</style>
